import {request} from '@/utils/request.js'

/**
 * 提单 API JS
 */

export default {

    /**
     * 获取提单分页列表
     * @returns
     */
    getList(params = {}) {
        return request({
            url: 'document/waybill/index',
            method: 'get',
            params
        })
    },

    /**
     * 添加提单
     * @returns
     */
    save(data = {}) {
        return request({
            url: 'document/waybill/save',
            method: 'post',
            data
        })
    },
    saveSon(data = {}) {
        return request({
            url: 'document/waybill/saveSon',
            method: 'post',
            data
        })
    },

    /**
     * 更新提单数据
     * @returns
     */
    update(data = {}) {
        return request({
            url: 'document/waybill/update/' + data.id,
            method: 'put',
            data
        })
    },

    /**
     * 读取提单
     * @returns
     */
    read(id) {
        return request({
            url: 'document/waybill/read/' + id,
            method: 'get',
        })
    },

    /**
     * 设置 定仓/出发/到站/清关等信息
     * @returns
     */
    changeInit(data) {
        return request({
            url: 'document/waybill/changeInit',
            method: 'put',
            data
        })
    },
    changeBooking(data) {
        return request({
            url: 'document/waybill/changeBooking',
            method: 'put',
            data
        })
    },
    changeSetOut(data) {
        return request({
            url: 'document/waybill/changeSetOut',
            method: 'put',
            data
        })
    },
    changeArrived(data) {
        return request({
            url: 'document/waybill/changeArrived',
            method: 'put',
            data
        })
    },
    changeClearance(data) {
        return request({
            url: 'document/waybill/changeClearance',
            method: 'put',
            data
        })
    },
    changeOver(data) {
        return request({
            url: 'document/waybill/changeOver',
            method: 'put',
            data
        })
    },
    changeTake(data) {
        return request({
            url: 'document/waybill/changeTake',
            method: 'put',
            data
        })
    },
    changeGet(data) {
        return request({
            url: 'document/waybill/changeGet',
            method: 'put',
            data
        })
    },
    changeVoid(data) {
        return request({
            url: 'document/waybill/changeVoid',
            method: 'put',
            data
        })
    },
    changeBack(data) {
        return request({
            url: 'document/waybill/changeBack',
            method: 'put',
            data
        })
    },
    /**
     * 将提单删除，有软删除则移动到回收站
     * @returns
     */
    deletes(data) {
        return request({
            url: 'document/waybill/delete',
            method: 'delete',
            data
        })
    },

    /**
     * 从回收站获取提单数据列表
     * @returns
     */
    getRecycleList(params = {}) {
        return request({
            url: 'document/waybill/recycle',
            method: 'get',
            params
        })
    },

    /**
     * 恢复提单数据
     * @returns
     */
    recoverys(data) {
        return request({
            url: 'document/waybill/recovery',
            method: 'put',
            data
        })
    },

    /**
     * 真实删除提单
     * @returns
     */
    realDeletes(data) {
        return request({
            url: 'document/waybill/realDelete',
            method: 'delete',
            data
        })
    },

    /**
     * 更改提单数据
     * @returns
     */
    changeStatus(data = {}) {
        return request({
            url: 'document/waybill/changeStatus',
            method: 'put',
            data
        })
    },


    addParcel(data = {}) {
        return request({
            url: 'document/waybill/addParcel',
            method: 'post',
            data
        })
    },

    addParcelById(data = {}) {
        return request({
            url: 'document/waybill/addParcelById',
            method: 'post',
            data
        })
    },

    delParcel(data = {}) {
        return request({
            url: 'document/waybill/delParcel',
            method: 'post',
            data
        })
    },
    /**
   * 审计
   * @returns
   */
  auditPass (data) {
    return request({
      url: 'document/waybill/audit/pass',
      method: 'post',
      data
    })
  },
  /**
   * 反审计
   * @returns
   */
  auditRefuse (data) {
    return request({
      url: 'document/waybill/audit/refuse',
      method: 'post',
      data
    })
  },
  //成本核算
  getFeeTotal (id,data={}) {
    return request({
      url: 'document/waybill/getFeeTotal/'+id,
      method: 'post',
      data
    })
  },
  //装箱
  PutParcel (data={}) {
    return request({
      url: 'document/shipmentWaybillParcel/PutParcel',
      method: 'post',
      data
    })
  },
  //出箱
  OutParcel (data={}) {
    return request({
      url: 'document/shipmentWaybillParcel/OutParcel',
      method: 'post',
      data
    })
  },
  //封箱
  CloseParcel (data={}) {
    return request({
      url: 'document/shipmentWaybillParcel/CloseParcel',
      method: 'post',
      data
    })
  },
  //完成配货
  closeOrderPass (data={}) {
    return request({
      url: 'document/waybill/closeOrder/pass',
      method: 'post',
      data
    })
  },
  //统计
  listTotal (data={}) {
    return request({
      url: 'document/waybill/listTotal',
      method: 'post',
      data
    })
  },
  delivery (data={}) {
    return request({
      url: 'document/waybill/delivery',
      method: 'post',
      data
    })
  },
  createDelivery (data={}) {
    return request({
      url: 'document/waybill/createDelivery',
      method: 'post',
      data
    })
  },
  getAllRoute (data={}) {
    return request({
      url: 'document/waybill/getAllRoute',
      method: 'post',
      data
    })
  },
}